<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/amazeui.min.css" />
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/hy.admin.css" />
		<style type="text/css">
			.hy-js-fieldarea label{ border: 2px solid #ddd; width: 100%;background: #ddd;height: 40px;border-radius: 4px;line-height: 30px;padding-left: 10px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
		     .am-icon-photo{ cursor: pointer;}
		</style>
	</head>

	<body>
		<div class="am-g">
			{include file='../Common/hy_header.html'}
			<form class="am-form hy-js-form" style="touch-action: pan-y; -webkit-user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">
				<div class="am-g am-margin-top">
					<div class="am-u-sm-2 am-text-right">
						规格名称
					</div>
					<div class="am-u-sm-4 am-u-end">
						<input type="text" name="type_name" value="{$art_list.type_name}" placeholder="如：衣服" class="am-input-sm">
					</div>
				</div>

				<div class="am-tabs am-margin" data-am-tabs="{ noSwipe: 1}">
					<ul class="am-tabs-nav am-nav am-nav-tabs">
						<li class="am-active"><a hidefocus="true" href="#tab1">基本详情</a>
						</li>
						{if $_C.DIGLOSSIA==1}
						<li><a hidefocus="true" href="#tab2">英文详情</a>
						</li>
						{/if}
					</ul>
					<div class="am-tabs-bd ">
						<div class="am-tab-panel am-fade  am-active am-in" id="tab1">
							<table class="am-table am-table-striped am-table-hover hy-table-main">
								<thead>
									<tr>
										<th class="table-check">
											<input class="hy-js-selectall" type="checkbox" />
										</th>
										<th class="table-id">ID</th>
										<th class="table-title">规格名称</th>
										<th class="table-type">样式</th>
										<th class="table-date">数据项</th>
										<th class="table-set">操作</th>
									</tr>
								</thead>
								<tbody class="hy-js-chdata">
									<tr>
										<td>
											<input class="hy-js-id" type="checkbox" value="{$art.id}" />
										</td>
										<td><input type="hidden" name="attr_id" id="attr_id" value="-1" /></td>
										<td>
											<input type="text" placeholder="如:尺寸" name="name" id="" value="" />
										</td>
										<td>
											<select name="type">
												<option value="1">单选框</option>
												<option value="2">输入框</option>
												<option value="3">复选框</option>
											</select>
										</td>
										<td>
											<input type="text" class="hy-js-explode" name="field" id="" placeholder="如:‘M，L，XL’,请用空格分开" />
										</td>
										<td>
											<div class="am-btn-toolbar">
												<div class="am-btn-group am-btn-group-xs">
													<a href="javascript:;" class="am-btn am-btn-default am-btn-xs am-text-secondary hy-js-newchdata"><span class="am-icon-plus"></span> 新增</a>
													<button data-hide='4' class="am-btn am-btn-default am-btn-xs am-text-danger hy-js-delchdata hy-hide"><span class="am-icon-trash-o"></span> 删除</button>
												</div>
											</div>
										</td>
									</tr>
									{foreach from=$art_list.ch_list item=art}
									<tr>
										<td>
											<input class="hy-js-id" type="checkbox" value="{$art.id}" />
										</td>
										<td>{$art.id}<input type="hidden" name="attr_id" id="attr_id" value="{$art.id}" /></td>
										<td>
											<input type="text" placeholder="如:尺寸" name="name" id="" value="{$art.name}" />
										</td>
										<td>
											<select name="type">
												<option {if $art.type==1} selected="selected" {/if}value="1">单选框</option>
												<option {if $art.type==2} selected="selected" {/if} value="2">输入框</option>
												<option {if $art.type==3} selected="selected" {/if} value="3">复选框</option>
											</select>
										</td>
										<td>
											<input type="text" class="hy-js-explode" name="field" id="" value="{$art.field}" placeholder="如:‘M，L，XL’" />
										</td>
										<td>
											<div class="am-btn-toolbar">
												<div class="am-btn-group am-btn-group-xs">
		                                             <button data-hide='4'data-id="{$art.id}" class="am-btn am-btn-default am-btn-xs am-text-danger hy-js-delchdata"><span class="am-icon-trash-o"></span> 删除</button>
												</div>
											</div>
										</td>
									</tr>
									{/foreach}
								</tbody>
							</table>

						</div>
						{if $_C.DIGLOSSIA==1}
						<div class="am-tab-panel am-fade" id="tab2">
							<table class="am-table am-table-striped am-table-hover hy-table-main">
								<thead>
									<tr>
										<th class="table-check">
											<input class="hy-js-selectall" type="checkbox" />
										</th>
										<th class="table-id">ID</th>
										<th class="table-title">规格名称</th>
										<th class="table-type">样式</th>
										<th class="table-date">数据项</th>
										<th class="table-set">操作</th>
									</tr>
								</thead>
								<tbody class="hy-js-endata">
									<tr>
										<td>
											<input class="hy-js-id" type="checkbox" value="" />
										</td>
										<td></td>
										<td>
											<input type="text" placeholder="如:尺寸" name="en_name" id="" value="" />
										</td>
										<td>
											
										</td>
										<td>
											<input type="text" name="en_field" id="" placeholder="如:‘M，L，XL’" />
										</td>
										<td>
											<div class="am-btn-toolbar">
												<div class="am-btn-group am-btn-group-xs">
												</div>
											</div>
										</td>
									</tr>
									{foreach from=$art_list.en_list item=art}
									<tr>
										<td>
											<input class="hy-js-id" type="checkbox" value="" />
										</td>
										<td></td>
										<td>
											<input type="text" placeholder="如:尺寸" name="en_name" id="" value="{$art.en_name}" />
										</td>
										<td>
											
										</td>
										<td>
											<input type="text" name="en_field" value="{$art.en_field}" id="" placeholder="如:‘M，L，XL’" />
										</td>
										<td>
											<div class="am-btn-toolbar">
												<div class="am-btn-group am-btn-group-xs">
												</div>
											</div>
										</td>
									</tr>
									{/foreach}
								</tbody>
							</table>
						</div>
						{/if}
						<input type="hidden" name="type_id" value="{$art_list.type_id}" />
					</div>
			</form>
			<div class="am-margin">
				<button type="button" class="am-btn am-btn-primary hy-js-submit am-btn-xs">提交保存</button>

			</div>
			</div>
		</div>

		{include file='../Common/hy_footer.html'}
		<script type="text/javascript" src="{$_C.hy_path}js/editor/kindeditor.js"></script>
		<script type="text/javascript">
			hy_submit('index.php?g=admin&m=goods&a={$action}');
			    $('.hy-js-newchdata').live('click',function(e){
			    	e.preventDefault();
			    	$(this).next('.hy-js-delchdata').show();
			    	$(this).hide();
			    	var html='<tr><td><input class="hy-js-id" type="checkbox" value=""/></td><td><input type="hidden" name="attr_id" id="attr_id" value="-1" /></td><td><input type="text" placeholder="如:尺寸" name="name" id="" value="" /></td><td><select name="type"><option value="1">单选框</option><option value="2">输入框</option><option value="3">复选框</option></select></td><td><input type="text" name="field" id="" placeholder="如:‘M，L，XL’" /></td><td><div class="am-btn-toolbar"><div class="am-btn-group am-btn-group-xs"><button   class="am-btn am-btn-default am-btn-xs am-text-secondary hy-js-newchdata"><span class="am-icon-plus"></span> 新增</button><button data-hide="4"   class="hy-hide am-btn am-btn-default am-btn-xs am-text-danger hy-js-delchdata"><span class="am-icon-trash-o"></span> 删除</button></div></div></td></tr>';
			    	$('.hy-js-chdata').prepend(html);
			    	{if $_C.DIGLOSSIA==1}
			    	var html='<tr><td><input class="hy-js-id" type="checkbox" value=""/></td><td><input type="hidden" name="attr_id" id="attr_id" value="-1" /></td><td><input type="text" placeholder="如:尺寸" name="en_name" id="" value="" /></td><td></td><td><input type="text" name="en_field" id="" placeholder="Forexamle:‘M，L，XL’" /></td><td><div class="am-btn-toolbar"><div class="am-btn-group am-btn-group-xs"></div></div></td></tr>';
			    	$('.hy-js-endata').prepend(html);
			    	{/if}
			    });
			    
			    $('.hy-js-delchdata').live('click',function(e){
			    	
			    	e.preventDefault();
			    	var _this=$(this);
			    	var line=$(this).parent().parent().parent().parent();
			    	var line_num=$('.hy-js-chdata').find("tr").index(line);
			        var hide=$(this).attr('data-hide');
			     	var parent='';
			    	var id=_this.attr('data-id');
			    	if(id>0)
			    	{
			    		if(confirm('确定要删除此项吗？'))
			    		{
			    			$.post('index.php?g=admin&m=goods&a=del_spec',{ id:id},function(result)
			    			{
			    				showMsg(result.content,result.error);
			    				if(result.error==0)
			    				{
			    					 if(hide)
				                   {
					                 for(i=0;i<hide;i++)
			                        {
				                        parent+='.parent()';
				                     } 
				                   }
				                    eval('_this'+parent+'.remove()');
				   	               {if $_C.DIGLOSSIA==1}
				   	                   var en_line=$('.hy-js-endata').find("tr");
				                       en_line[line_num].remove();
				                    {/if}
			    				}
			    			}
			    		    ,'json');
			    		}
			    		else
			    		{
			    			return;
			    		}
			    	}
			    	else
			    	{
			    		 if(hide)
				        {
					       for(i=0;i<hide;i++)
			              {
				               parent+='.parent()';
				          }
				        }
				        eval('_this'+parent+'.remove()');
				   	    {if $_C.DIGLOSSIA==1}
				   	     var en_line=$('.hy-js-endata').find("tr");
				        en_line[line_num].remove();
				         {/if}
			    	}
				    
				
			    })
		</script>
	</body>

</html>